package org.lanqiao.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import org.lanqiao.business.Ad;
import org.lanqiao.business.IAdService;
import org.lanqiao.mapper.AdMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

@Service
public class AdServiceImpl implements IAdService {
    @Autowired
    private AdMapper adMapper;
    @Override
    public List<Ad> findByPosition(String position) {
        return adMapper.selectList(new QueryWrapper<Ad>().eq("position",position)
                                                            .le("start_time",new Date())
                                                             .ge("end_time",new Date())
                                                            .eq("status","1"));
    }
}
